<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .title {
            font-size: 30px;
        }
    </style>
</head>
<body>
<div class="title">h5页面</div>
<div id="content"></div>
<script>
    var currentPort = null
    window.onmessage = (event) => {
       if(event.data === "trans_port") {
          currentPort = event.ports[0]
          if(currentPort) {
            currentPort.onmessage =(params)=>{
            document.querySelector('#content').innerText=params.data
            }
          }
       }
    }
</script>
</body>
</html>